<?
#echo $_SERVER["argv"][1];

//ini_set('default_charset','UTF-8');

#die();
ini_set("display_errors" ,true);
include('../core/core.php');

Core::Init(PageType::SERVER);
Router::$controllerMethodSeek = false;
Router::$popParamUnpaired = false;

Core::AddIncludePath(Config::Get('PATH_CORE') . 'lib' . DIRECTORY_SEPARATOR . 'Payments' . DIRECTORY_SEPARATOR);
Core::AddIncludePath(Config::Get('PATH_CORE') . 'lib' . DIRECTORY_SEPARATOR . 'Payments' . DIRECTORY_SEPARATOR . 'model' . DIRECTORY_SEPARATOR);

if(isset($_SERVER["argv"][1])) {
	$action = $_SERVER["argv"][1];
} else if (isset($_REQUEST['action'])) {
	$action = $_REQUEST['action'];
} else {
	$action = "Index";
}

if (isset($_SERVER['argv'][2])) {
	$controller = $_SERVER['argv'][2];
} else if (isset($_REQUEST['controller'])) {
	$controller = $_REQUEST['controller'];
} else {
	$controller = 'Server';
}

$controller = ucfirst($controller."Controller");
$action = ucfirst($action."Action");

/**
 * Autoloader klas
 *
 * @param unknown_type $className
 */
function __autoload($className) {
	Core::LoadClass($className);
}
include("../Strona/routes.php");
include_once(Config::Get('PATH_MAIN') . 'controller' . DIRECTORY_SEPARATOR . $controller . '.php');
echo Config::Get('PATH_MAIN') . 'controller' . DIRECTORY_SEPARATOR . $controller . '.php';
$cnt = new $controller();
$cnt->$action(array());

//Core::LoadSmarty();

//$front = new FrontController();

//$front->Dispatch();

Core::Garbage();

//echo "CronScript";
?>